<template>
  <div class="tjb" v-loading="isLoading">
    <el-collapse v-model="activeNames" @change="handleChange">
      <el-collapse-item name="1">
        <template slot="title">
          <div>
            <i
              class="el-icon-document"
              style="font-size: 22px; margin-right: 10px"
            ></i>
            <span style="font-weight: 900; font-size: 16px"
              >个体化健康教育</span
            >
            <!-- <el-button
              size="small"
              type="primary"
              icon="el-icon-plus"
              style="position: absolute; right: 8%; margin-top: 8px"
              @click.stop="goto_open"
              >新增健康教育表</el-button
            > -->
          </div>
        </template>
        <div>
          <el-table
            :data="tableData"
            style="width: 100%; margin-top: 15px"
            :header-cell-style="{
              color: '#000',
              backgroundColor: 'rgb(222,234,255)',
            }"
            height="250"
          >
            <el-table-column prop="createtime" label="创建时间"> </el-table-column>
            <el-table-column prop="updatetime" label="最近更新时间">
            </el-table-column>
            <el-table-column prop="visitDate" label="日期"> </el-table-column>
            <el-table-column prop="createUserId" label="随访医生"> </el-table-column>
            <el-table-column prop="createUnitId" label="随访单位"> </el-table-column>
            <el-table-column prop="summary" label="活动内容"> </el-table-column>
            <el-table-column
              prop="date"
              label="操作"
              fixed="right"
              width="220"
              align="center"
            >
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  plain
                  size="mini"
                  style="background-color: #fff; color: rgb(47, 160, 254)"
                  @click="goto_open(scope.row)"
                  >预览</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-collapse-item>
      <el-collapse-item name="2" v-if="false">
        <template slot="title">
          <div>
            <i
              class="el-icon-document"
              style="font-size: 22px; margin-right: 10px"
            ></i>
            <span style="font-weight: 900; font-size: 16px">健康教育活动</span>
          </div>
        </template>
        <div>
          <el-table
            :data="tableData"
            style="width: 100%; margin-top: 15px"
            :header-cell-style="{
              color: '#000',
              backgroundColor: 'rgb(222,234,255)',
            }"
            height="250"
          >
            <el-table-column prop="date" label="序号"> </el-table-column>
            <el-table-column prop="date" label="创建时间"> </el-table-column>
            <el-table-column prop="date" label="最近更新时间">
            </el-table-column>
            <el-table-column prop="date" label="活动时间"> </el-table-column>
            <el-table-column prop="date" label="活动形式"> </el-table-column>
            <el-table-column prop="date" label="参与活动医生">
            </el-table-column>
            <el-table-column prop="date" label="组织单位"> </el-table-column>
            <el-table-column prop="date" label="服务项目"> </el-table-column>
            <el-table-column
              prop="date"
              label="操作"
              fixed="right"
              width="220"
              align="center"
            >
              <template slot-scope="">
                <el-button
                  type="primary"
                  plain
                  size="mini"
                  style="background-color: #fff; color: rgb(47, 160, 254)"
                  >下载</el-button
                >
                <el-button
                  type="primary"
                  plain
                  size="mini"
                  style="background-color: #fff; color: rgb(47, 160, 254)"
                  >预览</el-button
                >
                <el-button
                  type="primary"
                  plain
                  size="mini"
                  style="background-color: #fff; color: rgb(47, 160, 254)"
                  >修改</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-collapse-item>
    </el-collapse>
    <!-- 弹层开始 -->
    <el-dialog
      title="健康体检表"
      :visible.sync="dialogVisible"
      width="96%"
      style="margin-top: -10vh"
      :before-close="handleClose"
      :append-to-body="true"
      :close-on-click-modal="false"
    >
      <div style="height: 65vh; overflow: auto">
        <gthjkjy ref="child"></gthjkjy>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 弹层结束 -->
  </div>
</template>
  
  <script>
import gthjkjy from "@/views/dialog_info/gthjkjy.vue"; // 个体化健康教育
export default {
  components: {
    gthjkjy,
  },
  data() {
    return {
      activeNames: [],
      tableData: [],
      dialogVisible: false,
      isLoading: false,
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      this.isLoading = true;
      this.tableData = [];
      var data = {
        idNo: localStorage.getItem("idCard"),
        Page: 1,
        Size: 999,
      };
      this.$post("/healthEdu/PageList", data).then((res) => {
        this.tableData = res.data.records;
        this.isLoading = false;
      });
    },
    handleChange(val) {
    },
    goto_open(item) {
      var init = JSON.stringify(item);
      var body = JSON.parse(init);
      this.dialogVisible = true;
      setTimeout((_) => {
        this.$refs.child.getInfo(body);
      }, 100);
    },
    handleClose() {
      this.dialogVisible = false;
    },
  },
};
</script>
  
  <style lang="scss" scoped>

</style>